import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import Layout from 'components/layout/index.vue';

// 静态路由
export const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/home',
    name:'home',
    redirect: '/home/staff',
    component: Layout,
    children: [
      // {
      //   path: 'account',
      //   name: 'account',
      //   component: () => import('@/views/Home/account/index.vue'),
      //   meta: { menuName:'账号管理', icon: 'el-icon-setting', menuId: '1-1' },
      // },
      // {
      //   path: 'warning',
      //   name: 'warning',
      //   component: () => import('@/views/Home/warning/index.vue'),
      //   meta: { menuName:'预警首页', icon: 'el-icon-setting', menuId: '1-2' },
      // },
      // {
      //   path: 'logManage',
      //   name: 'logManage',
      //   component: () => import('@/views/Home/logManage/index.vue'),
      //   meta: { menuName:'日志管理', icon: 'el-icon-setting', menuId: '1-3' },
      // },
      {
        path: 'staff',
        name: 'Staff',
        component: () => import('@/views/Home/staff/index.vue'),
        meta: { menuName:'员工管理', icon: 'el-icon-setting', menuId: '1-4' },
      },
      {
        path: 'device',
        name: 'device',
        component: () => import('@/views/Home/device/index.vue'),
        meta: { menuName:'设备管理', icon: 'el-icon-setting', menuId: '1-6' },
      },
      // {
      //   path: 'schedule',
      //   name: 'schedule',
      //   component: () => import('@/views/Home/schedule/index.vue'),
      //   meta: { menuName:'进度计划管理', icon: 'el-icon-setting', menuId: '1-5' },
      // }
    ]
  },
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import( '@/views/Login/index.vue'),
    meta: { menuName:'登录', icon: 'el-icon-setting', menuId: '0-1'  }
  },
  {
    path: '/bg',
    name: 'Bg',
    component: () => import( '@/views/bg/index.vue'),
    meta: { menuName:'指挥页', icon: 'el-icon-setting', menuId: '0-2'  }
  }
]

const router = createRouter({
  history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
  scrollBehavior: () => ({
    top: 0
  }),
  routes: constantRoutes
})
export default router
